home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
ADDTHEM.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
511b
|
18 lines
' ADDTHEM.BAS
' This program reads and adds values stored in DATA statements.
CONST ITEMS% = 20 ' set the number of items to be read
CLS
FOR i% = 1 TO ITEMS% ' for each item to be read
READ number! ' assign the next DATA item to number!
sum! = sum! + number! ' add the item to the running total
NEXT i%
PRINT "The sum of the"; ITEMS%; "numbers is"; sum!
DATA 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
DATA 88.2, 25, 3.3, 100, -74.2, 0, 20, 0.34, -89, 5.4567